//
// Created by xili on 2024/8/8 18:39.
// Go big or go home.
//
#include <vector>

using namespace std;

class Solution {
public:
    int valueAfterKSeconds(int n, int k) {
        vector<long long> pre(n, 1);
        while (k--)
            for (int i = 1; i < n; ++i)
                pre[i] = (pre[i - 1] + pre[i]) % 1000000007;
        return pre[n - 1];
    }
};